package com.msh.artascope.devcloud.client.po;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.msh.artascope.interfaces.ILoginAccount;
import java.util.Date;
import com.msh.frame.client.base.BasePo;
import com.msh.frame.client.validation.*;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Null;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author shihu
 * @mail m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "健康检测Po")
public class HealthTestPo extends BasePo{
  @NotNull(groups = {IUpdateVo.class}, message = "id不能为空")
  @Schema(name = "主键id")
  private Long id;

  @NotNull(groups = {IInsertVo.class},message = "模块id不能为空")
  @Schema(name = "模块id")
  private Long moduleId;

  @NotNull(groups = {IInsertVo.class},message = "类型(准备,存活)不能为空")
  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 6, message = "type长度范围最大6")
  @Schema(name = "类型(准备,存活)")
  private String type;

  @NotNull(groups = {IInsertVo.class},message = "探测模式不能为空")
  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 10, message = "probeMode长度范围最大10")
  @Schema(name = "探测模式")
  private String probeMode;

  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 255, message = "probeParam长度范围最大255")
  @Schema(name = "探测参数")
  private String probeParam;

  @NotNull(groups = {IInsertVo.class},message = "延迟探测时间不能为空")
  @Schema(name = "延迟探测时间")
  private Integer initialDelaySeconds;

  @NotNull(groups = {IInsertVo.class},message = "执行探测频率不能为空")
  @Schema(name = "执行探测频率")
  private Integer periodSeconds;

  @NotNull(groups = {IInsertVo.class},message = "超时时间不能为空")
  @Schema(name = "超时时间")
  private Integer timeoutSeconds;

  @NotNull(groups = {IInsertVo.class},message = "不健康阀值不能为空")
  @Schema(name = "不健康阀值")
  private Integer failureThreshold;

  @Schema(name = "租户")
  private Long tenantId;

  @NotNull(groups = {IUpdateVo.class}, message = "更新版本不能为空")
  @Schema(name = "更新版本")
  private Integer updateVersion;


  public void initLoginAccount(ILoginAccount loginAccount){
    this.tenantId = loginAccount.getTenantId();
  }
}



